﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;

namespace RescueRobotController.Panels
{
    public partial class ChassisJibPanel : DockContent
    {
        // 下面的内容是每个面板必须要有的
        // *********** BEGIN ************* //
        // “发送AT指令”事件
        public delegate void ExistATCmdToSendHandler(ATCmd cmd);
        public event ExistATCmdToSendHandler SendATCmd;

        // 处理AT指令
        public void HandleATCmd(ATCmd cmd)
        {

        }
        // *********** END ************* //
        public ChassisJibPanel()
        {
            InitializeComponent();
        }

        private void numeric_front_ValueChanged(object sender, EventArgs e)
        {
            SendATCmd(new ATCmd()
            {
                type = ATCmdType.SET,
                target = "CHASSIS_JB1_ANGLE",
                value = numeric_front.Value.ToString()
            });
        }

        private void numeric_backend_ValueChanged(object sender, EventArgs e)
        {
            SendATCmd(new ATCmd()
            {
                type = ATCmdType.SET,
                target = "CHASSIS_JB2_ANGLE",
                value = numeric_backend.Value.ToString()
            });
        }
    }
}
